<?php

namespace app\common\model\xilujob;

use think\Model;
use function fast\array_get;

class PersonalMessage extends Model
{

    const TYPE_APPLY_SENT = 1; //简历投递后发给企业用户
    const TYPE_RESUME_VIEWED = 2; //简历被查看后通知个人用户
    const TYPE_APPLY_REJECTED = 3; //简历投递被拒绝后发给个人用户
    const TYPE_INTERVIEW_SENT = 4; //面试邀请发出后通知个人用户
    const TYPE_INTERVIEW_REJECTED = 5; //面试邀请被个人用户拒绝，通知企业
    const TYPE_INTERVIEW_ACCEPTED = 6; //面试邀请被个人用户确认，通知企业
    const TYPE_INTERVIEW_FAILED = 7; //面试失败， 通知用户
    const TYPE_INTERVIEW_PASSED = 8; //面试通过，通知用户
    const TYPE_JOB_SIGNUP = 10; //职位报名， 通知企业

    const TYPE_JOB_RECOMMEND = 9; // 推荐职位给用户， 不发站内消息

    protected $name = 'xilujob_personal_message';

    protected $autoWriteTimestamp = 'int';
    protected $dateFormat = 'Y-m-d H:i:s';

    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    public function setExtraAttr($value, $data) {
        return is_string($value) ? $value : json_encode($value, JSON_UNESCAPED_UNICODE);
    }

    public function getExtraAttr($value, $data) {
        $value = $value ? : array_get($data, 'extra');
        return is_string($value) ? json_decode($value,true) : $value;
    }


}
